import {
  getDrawingPreviewUrl,
  getWorkOrderInforExtendByPage,
  getManufactInfo,
  getDrawingInfo,
  getBomOverview,
  exportWorkOrderInfor,
  releaseWorkOrderInfor,
  getDrawingPrintHstByWoIdAndPage,
  addDrawingPrintHst,
  viewBaseInfo,
  closeWorkOrderInfor,
} from '@/services/product/workOrderInfor';
import { tableSearchPublicConfig } from '@/utils/filterUtils';
import { Ellipsis } from '@/components/Ellipsis';
import './product.module.less';
import { PlusOutlined, UploadOutlined } from '@ant-design/icons';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import type { ActionType, ProColumns } from '@ant-design/pro-table';
import ProTable from '@ant-design/pro-table';
import {
  Button,
  Tabs,
  Modal,
  Table,
  Row,
  Col,
  message,
  Tag,
  Form,
  Input,
  Select,
  Upload,
} from 'antd';
import { sortTran, filterTran, filterTranNew } from '@/utils/requestUtil';
import React, { useRef, useState } from 'react';
import type { ColumnsType } from 'antd/es/table';
import { getTimeProps } from 'antd/lib/date-picker/generatePicker';
import moment from 'moment';
import {
  exportBatchProduct,
  exportWorkhourAndCycle,
  getBatchProductByPage,
  getBopCodeAndName,
  setBop,
  uploadWorkhourAndCycle,
} from '@/services/design/productDesign';
import { getProductTypeList } from '@/services/templateMaintain/inspectionTemplate';
import type { recordInfoType } from './components/interfaceProduct';
import UnstandprocessInfo from '../design/unstandprocessInfo';
const WorkOrderInfor: React.FC<{}> = () => {
  const actionRef = useRef<ActionType>();
  const ref = useRef(null);
  const [open, setOpen] = useState(false); //控制查看Modal的开关
  const [bomData, setBomdata] = useState();
  const [drawData, setDrawdata] = useState();
  const [draw_print, setdraw_print] = useState();
  const [recordCur, setRecord] = useState();
  const [manufactInfo, setManufactInfo] = useState();
  const [pagestate, setPageState] = useState<string>('0');
  const [thewoid, setthewoid] = useState('');
  const [selections, setSelections] = useState([]);
  const [modalVisit, setModalVisit] = useState(false); // 新建和编辑提示框
  const [modalVisit4, setModalVisit4] = useState(false); // 工时周期上传弹窗
  const [confirmLoading, setConfirmLoading] = useState(false); //加载
  const [formTitle, setFormTitle] = useState('添加工艺路径'); //工艺弹窗标题
  const [form] = Form.useForm();
  const [recordInfo, setrecordinfo] = useState<recordInfoType>();
  const [createOrUpdate, setCreateOrUpdate] = useState(false); //编辑框的disable
  const [optionsbopCode, setoptionsbopCode] = useState([]);

  //工时部分
  const [theunStandTypeId, settheunStandTypeId] = useState();
  const [thebopcode, setthebopcode] = useState();
  const [thetypecode, setthetypecode] = useState();
  const [thetypename, setthetypename] = useState();
  const [thedesc, setthedesc] = useState();
  const [modalVisit3, setModalVisit3] = useState(false); // 工序工时弹窗
  const [confirmLoading4, setConfirmLoading4] = useState(false);
  const [file, setFile] = useState();

  //类型定义
  type tabType = {
    name: string;
    label: string;
    content: JSX.Element;
  };

  //Tabs里面的表格
  interface DataType {
    title: string;
    dataIndex: string;
    key: string;
  }

  //排程状态数组
  const statusArray = ['未排程', '自动排程', '手动排程'];
  const releaseStatus = ['未释放', '已释放'];
  const statusChange = ['未变更', '存在变更'];
  const alertStatus = ['未开始', '执行中', '已完成', '未按计划开始', '未按计划结束']; //工单预警状态
  const state = ['未开始', '执行中', '已完成'];

  //定义一个样式
  const styleCommon = { fontSize: 16, marginBottom: 20 };
  const styleTitle = { fontWeight: 600 };

  const bomColumns: ColumnsType<DataType> = [
    {
      title: '物料编号',
      dataIndex: 'materialCode',
      key: 'materialCode',
    },
    {
      title: '物料名称',
      dataIndex: 'materialName',
      key: 'materialName',
    },
    {
      title: '物料型号',
      dataIndex: 'materialSpec',
      key: 'materialSpec',
    },

    {
      title: '（安装）位置号',
      dataIndex: 'positionNo',
      key: 'positionNo',
    },
    {
      title: '变更状态',
      dataIndex: 'changeStatus',
      key: 'changeStatus',
      render: (text, record, _, action) => {
        return <div>{record.changeStatus == 0 ? '未变更' : '存在变更'}</div>;
      },
    },
    {
      title: '需求数量',
      dataIndex: 'materialQty',
      key: 'materialQty',
      // render: (text, record, _, action) => {
      //   return record.materialQty + '/' + record.unit;
      // },
    },
    {
      title: '已发数量',
      dataIndex: 'outboundQty',
      key: 'outboundQty',
    },
    {
      title: '未发数量',
      dataIndex: 'notIssuedQty',
      key: 'notIssuedQty',
      render: (text) => {
        let color = 'black-font';
        if (text > 0) {
          color = 'red-font'; //数量大于0 则标为红色
        }
        return <div className={color}>{text}</div>;
      },
    },
    {
      title: '单位',
      dataIndex: 'unit',
      key: 'unit',
    },
  ];

  // 图纸列表
  const drawColumns: ColumnsType<DataType> = [
    {
      title: '图纸类型',
      dataIndex: 'category',
      key: 'category',
      align: 'center',
      sorter: true,
    },
    {
      title: '图纸编号',
      dataIndex: 'drawingCode',
      key: 'drawingCode',
      align: 'center',
      sorter: true,
    },
    {
      title: '文件名称',
      dataIndex: 'drawingName',
      key: 'drawingName',
      align: 'center',
      sorter: true,
    },
    // {
    //   title: '是否打印',
    //   dataIndex: 'printFlag',
    //   key: 'printFlag',
    //  align: 'center',sorter: true,
    //   render: (text, record, _, action) => {
    //     return <div>{record.printFlag == 0 ? '未打印' : '已打印'}</div>;
    //   },
    // },
    {
      title: '归档状态',
      dataIndex: 'archiveFlag',
      key: 'archiveFlag',
      align: 'center',
      sorter: true,
      render: (text, record, _, action) => {
        return <div>{record.archiveFlag == 0 ? '使用中' : '已归档'}</div>;
      },
    },
    {
      title: '上传人',
      dataIndex: 'createName',
      key: 'createName',
      align: 'center',
      sorter: true,
    },
    {
      title: '上传时间',
      dataIndex: 'createTime',
      key: 'createTime',
      align: 'center',
      sorter: true,
    },
    {
      title: '操作',
      valueType: 'option',
      key: 'option',
      fixed: 'right',
      align: 'center',
      render: (text, record, _, action) => [
        <a
          key={record.id}
          onClick={async () => {
            const url = await getDrawingPreviewUrl(record.id);
            const w = window.open('about:blank');
            if (url && url?.message) {
              w.location.href = url.message;
            } else {
              w.location.href = record.drawingUrl;
            }
            // w.location.href = record.drawingUrl;
            // 获取当前用户
            const getuserlist = await viewBaseInfo(null);
            // 新增打印信息
            const addparams = {
              drawingCode: record.drawingCode,
              drawingDesc: record.drawingName,
              drawingSequence: record.drawingSequence,
              drawingUrl: record.drawingUrl,
              printBy: getuserlist.data.name,
              printTime: moment().format('YYYY-MM-DD HH:mm:ss'),
              productCode: record.productCode,
              productDrawingInfoId: record.id,
              workOrderInforId: thewoid,
            };
            const result = addDrawingPrintHst(addparams);
            if (result != null) {
              message.success('打印成功');
            }
            //更新图纸打印列表
            const printParams = {
              workOrderInforId: thewoid,
              pageEntity: {
                current: 1,
                filters: [],
                pageSize: 7,
                sorters: [],
              },
            };
            const drawPrint = await getDrawingPrintHstByWoIdAndPage(printParams);
            drawPrint.data.content.map((item: any) => {
              item.key = thewoid;
            });
            setdraw_print(drawPrint.data.content);
            actionRef.current!.reload();
            setOpen(true);
          }}
        >
          预览打印
        </a>,
      ],
    },
  ];

  // 图纸打印list
  const draw_printcolumns: ColumnsType<DataType> = [
    {
      title: '柜体编号',
      dataIndex: 'productCode',
      key: 'productCode',
      align: 'center',
      sorter: true,
    },
    {
      title: '图纸编号',
      dataIndex: 'drawingCode',
      key: 'drawingCode',
      align: 'center',
      sorter: true,
    },
    {
      title: '文件名称',
      dataIndex: 'drawingDesc',
      key: 'drawingDesc',
      align: 'center',
      sorter: true,
    },
    // {
    //   title: '柜体图纸链接',
    //   dataIndex: 'drawingUrl',
    //   key: 'drawingUrl',
    // },
    {
      title: '打印时间',
      dataIndex: 'printTime',
      key: 'printTime',
      align: 'center',
      sorter: true,
    },
    {
      title: '打印人员',
      dataIndex: 'printBy',
      key: 'printBy',
      align: 'center',
      sorter: true,
    },
  ];

  const manuColumns: ColumnsType<DataType> = [
    {
      title: '名称',
      dataIndex: 'processName',
      align: 'center',
      sorter: true,
      key: 'processName',
    },
    {
      title: '柜体编号',
      dataIndex: 'batchProductCode',
      align: 'center',
      sorter: true,
      key: 'batchProductCode',
      width: 100,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '柜体类型',
      dataIndex: 'productType',
      align: 'center',
      sorter: true,
      key: 'productType',
      render: (text) => {
        return <div>{text ? text : '-'}</div>;
      },
    },
    {
      title: '计划开始时间',
      dataIndex: 'planManufactStartDate',
      align: 'center',
      sorter: true,
      key: 'planManufactStartDate',
    },
    {
      title: '计划结束时间',
      dataIndex: 'planManufactEndDate',
      align: 'center',
      sorter: true,
      key: 'planManufactEndDate',
    },
    {
      title: '实际开始时间',
      dataIndex: 'manufactStartDate',
      key: 'manufactStartDate',
      align: 'center',
      sorter: true,
      render: (text) => {
        return <div>{text ? text : '-'}</div>;
      },
    },
    {
      title: '实际结束时间',
      dataIndex: 'manufactEndDate',
      key: 'manufactEndDate',
      align: 'center',
      sorter: true,
      render: (text) => {
        return <div>{text ? text : '-'}</div>;
      },
    },
    {
      title: '标准工时',
      dataIndex: 'standManufactWorkhour',
      key: 'standManufactWorkhour',
      align: 'center',
      sorter: true,
      render: (text) => {
        return text == 0 ? '-' : text;
      },
    },
    // {
    //   title: '操作',
    //   key: 'option',
    //   fixed: 'right',
    //  align: 'center',sorter: true,
    //   render: (text, record, _, action) => [<a key="needKey"> 调整</a>, <a key="saveKey"> 保存</a>],
    // },
  ];

  // 工艺工时
  const tobeSubmitted: ProColumns[] = [
    {
      title: '序号',
      dataIndex: 'index',
      valueType: 'index',
      width: 50,
    },
    {
      title: '项目名称',
      dataIndex: 'projectName',

      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
      width: 185,
    },
    {
      title: '项目编号',
      dataIndex: 'projectCode',

      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
      width: 120,
    },
    {
      title: '批次交货日期',
      dataIndex: 'batchDeliveryDate',

      valueType: 'date',
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
      width: 120,
      search: false,
    },
    {
      title: '批次编号',
      dataIndex: 'batchPlanCode',

      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
      width: 180,
    },
    // {
    //   title: '主计划编号',
    //   dataIndex: 'masterPlanCode',
    // },
    {
      title: '柜体编号',
      dataIndex: 'productCode',

      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
      width: 190,
    },
    {
      title: '柜体描述',
      dataIndex: 'productDesc',

      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
      width: 200,
    },
    {
      title: '柜体类型',
      dataIndex: 'productType',

      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
      valueType: 'select',
      request: async () => {
        const getproduct = await getProductTypeList(null);
        const productOptionContract: any[] = [];
        getproduct.data.map((item: any, index: any) => {
          productOptionContract.push({ value: item, label: item });
        });
        return productOptionContract;
      },
    },
    {
      title: '是否标准柜体',
      dataIndex: 'isStandard',

      valueType: 'select',
      request: async () => [
        { label: '是', value: 1 },
        { label: '否', value: 0 },
      ],
      render: (text, record, _, action) => {
        return <div>{record.isStandard == 1 ? '是' : '否'}</div>;
      },
      align: 'center',
      sorter: true,
      width: 120,
    },
    {
      title: '技术人员',
      dataIndex: 'engineer',

      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '审核状态',
      dataIndex: 'reviewState',

      search: false,
      width: 100,
      align: 'center',
      sorter: true,
      valueType: 'select',
      request: async () => [
        { label: '待提交', value: 0 },
        { label: '待审批', value: 1 },
        { label: '已审批', value: 2 },
        { label: '已驳回', value: 3 },
      ],
      render: (text, record, _, action) => {
        return (
          <div>
            {record.reviewState == 0
              ? '待提交'
              : record.reviewState == 1
              ? '待审批'
              : record.reviewState == 2
              ? '已审批'
              : '已驳回'}
          </div>
        );
      },
    },
    {
      title: '状态',
      dataIndex: 'state',

      align: 'center',
      sorter: true,
      width: 90,
      valueType: 'select',
      request: async () => [
        { label: '未下发', value: 0 },
        { label: '设计中', value: 1 },
        { label: '工单下发', value: 2 },
        { label: '生产中', value: 3 },
      ],
      render: (text, record, _, action) => {
        return (
          <div>
            {record.state == 0
              ? '未下发'
              : record.state == 1
              ? '设计中'
              : record.state == 2
              ? '工单下发'
              : '生产中'}
          </div>
        );
      },
    },
    {
      title: 'BOM上传',
      dataIndex: 'bomId',

      align: 'center',
      sorter: true,
      width: 100,
      search: false,
      render: (text, record, _, action) => {
        return <div>{record.bomId == null ? '未上传' : '已上传'}</div>;
      },
    },
    {
      title: '图纸上传',
      dataIndex: 'drawingId',

      align: 'center',
      sorter: true,
      width: 100,
      search: false,
      render: (text, record, _, action) => {
        return <div>{record.drawingId == null ? '未上传' : '已上传'}</div>;
      },
    },
    {
      title: '工时设置',
      dataIndex: 'isStdWorkHourUploaded',

      align: 'center',
      sorter: true,
      width: 100,
      search: false,
      render: (text, record, _, action) => {
        return <div>{record.isStdWorkHourUploaded == 1 ? '已设置' : '未设置'}</div>;
      },
    },
    {
      title: '工艺路径',
      dataIndex: 'bopCode',

      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '设计计划开始',
      dataIndex: 'planDesignStartDate',

      search: false,
      valueType: 'date',
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '设计计划结束',
      dataIndex: 'planDesignEndDate',

      search: false,
      valueType: 'date',
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    // {
    //   title: '计划设计工时',
    //   dataIndex: 'planDesignWh',
    //
    //  align: 'center',sorter: true,
    //   render: (text) => <>{Ellipsis(text)}</>,
    // },
    {
      title: '实际设计开始',
      dataIndex: 'actualKickoffStartDate',

      search: false,
      valueType: 'date',
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '操作',
      valueType: 'option',
      key: 'option',
      fixed: 'right',
      align: 'center',
      width: 105,
      render: (text, record, _, action) => [
        <a
          key="productbopKey1"
          onClick={async () => {
            if (record.isStandard == 1) {
              message.warning('标准柜体不能修改工艺路径');
            } else if (record.bopIsChange == 1) {
              message.warning('不能再次修改工艺路径');
            } else {
              setModalVisit(true);
              setCreateOrUpdate(true);
              setFormTitle('添加工艺路径');
              form.setFieldsValue({
                bopCode: optionsbopCode[0].value,
                unStandTypeId: record.id,
                productCode: record.productCode,
                productDesc: record.productDesc,
              });
            }
          }}
        >
          工艺
        </a>,
        <a
          key="processinfoKey1"
          onClick={() => {
            settheunStandTypeId(record.id);
            setthebopcode(record.bopCode);
            setthetypecode(record.productCode);
            setthetypename(record.productType);
            setthedesc(record.productDesc);
            setModalVisit3(true);
          }}
        >
          工时
        </a>,
      ],
    },
  ];

  //取消查看Modal的弹窗
  const handleCancel = () => {
    setOpen(false);
  };

  //点击查看弹出Modal
  const openLookfor = async (id: string, record: any) => {
    //获取Tab的四种信息
    //1、第一种Bom
    const bomInfoTab = await getBomOverview(id);
    bomInfoTab.data.map((item: any) => {
      item.key = item.id;
    });
    setBomdata(bomInfoTab.data);
    //2、第二种图纸
    const drawImage = await getDrawingInfo(id);
    drawImage.data.map((item: any) => {
      item.key = id;
    });
    setDrawdata(drawImage.data);
    //3、设置本来的record信息
    setRecord(record);
    console.log('record正常', record);
    //4、getManufactInfon进度信息
    const manufactInfoTemp = await getManufactInfo(id);
    if (manufactInfoTemp) {
      manufactInfoTemp.data.map((item: any) => {
        item.key = item.id;
      });
      setManufactInfo(manufactInfoTemp.data);
    }
    //5、图纸打印列表
    const printParams = {
      workOrderInforId: id,
      pageEntity: {
        current: 1,
        filters: [],
        pageSize: 7,
        sorters: [],
      },
    };
    const drawPrint = await getDrawingPrintHstByWoIdAndPage(printParams);
    drawPrint.data.content.map((item: any) => {
      item.key = item.id;
    });
    setdraw_print(drawPrint.data.content);
    setOpen(true);
  };

  //释放工单
  const releaseFuc = async (id: string) => {
    const result = await releaseWorkOrderInfor(id);
    if (result && result.code === 0) {
      message.success(result.message);
    }
    actionRef.current!.reload();
  };

  //获取工艺路径
  const getproductbop = async () => {
    // 获取工艺路径编号和名称
    const getcode = await getBopCodeAndName(null);
    const codeandname = [];
    getcode?.data.map((item: any, index: any) => {
      codeandname.push({ value: item.bopCode, label: item.bopName });
    });
    // console.log(codeandname);
    setoptionsbopCode(codeandname);
  };

  // 选中项目，导出工时模板
  const rowSelection = {
    onChange: (selectedRowKeys: React.Key[], selectedRows: string[]) => {
      const temp: string[] = [];
      if (selectedRows !== null) {
        selectedRows.map((item) => {
          temp.push({
            projectCode: item.projectCode,
            projectInfoId: item.infoId,
            projectName: item.projectName,
          });
        });
      }
      setSelections(temp); //保存项目信息
    },
  };

  // 设置工艺路径
  const handleSubmit = async () => {
    setConfirmLoading(true);
    form
      .validateFields()
      .then(async () => {
        const res = form.getFieldsValue();
        console.log(res);
        const result = await setBop(res);
        if (result != null) {
          message.success('设置工艺路径成功');
        }
        setConfirmLoading(false);
        setModalVisit(false);
        actionRef.current!.reload();
      })
      .catch(() => {
        setConfirmLoading(false);
      });
  };

  // 上传工时模板提交
  const workhour_upload = async () => {
    setConfirmLoading4(true);
    form
      .validateFields()
      .then(async () => {
        const res = { ...form.getFieldsValue() };
        const formData = new window.FormData();
        res.file.fileList.map((file: any) => {
          formData.append('file', file.originFileObj);
        });
        res.file = formData;
        const result = await uploadWorkhourAndCycle({ file: res.file });
        if (result != null && result.code == 0) {
          message.success('上传成功');
          form.resetFields();
        }
        setConfirmLoading4(false);
        setModalVisit4(false);
        actionRef.current!.reload();
      })
      .catch(() => {
        setConfirmLoading4(false);
      });
  };

  const onFilesChange = async (file) => {
    setFile(file);
  };
  const beforeUpload = (file) => {
    setFile(file);
    return false;
  };

  //定义Tabs的子结构的数组
  const tabList: tabType[] = [
    {
      name: 'tab1',
      label: '详情信息',
      content: (
        <Row>
          {/* <Col span={4}></Col> */}
          <Col span={8} offset={4}>
            <div style={styleCommon}>
              <span style={styleTitle}>柜体类型 </span> :&nbsp;
              {recordCur == undefined ? '' : recordCur!.productType}
            </div>
            <div style={styleCommon}>
              <span style={styleTitle}>柜体编号</span> :&nbsp;
              {recordCur == undefined ? '' : recordCur!.batchProductCode}
            </div>
            <div style={styleCommon}>
              <span style={styleTitle}>数&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;量</span> :&nbsp;
              1
            </div>
            <div style={styleCommon}>
              {/* columns */}
              <span style={styleTitle}>项目名称</span> :&nbsp;
              {recordCur == undefined ? '' : recordCur!.projectName}
            </div>
            <div style={styleCommon}>
              <span style={styleTitle}>项目编号</span> :&nbsp;
              {recordCur == undefined ? '' : recordCur!.projectCode}
            </div>
          </Col>
          <Col span={8} offset={4}>
            <div style={styleCommon}>
              <span style={styleTitle}>下&nbsp;&nbsp;发&nbsp;&nbsp;状&nbsp;&nbsp;态</span> :&nbsp;
              {recordCur == undefined ? '' : releaseStatus[recordCur.releaseFlag]}
            </div>
            <div style={styleCommon}>
              <span style={styleTitle}>排&nbsp;&nbsp;程&nbsp;&nbsp;状&nbsp;&nbsp;态</span> :&nbsp;
              {recordCur == undefined ? '' : statusArray[recordCur.scheduledFlag]}
            </div>
            <div style={styleCommon}>
              <span style={styleTitle}>计划开始时间</span> :&nbsp;
              {recordCur == undefined ? '' : recordCur!.planManufactStartDate}
            </div>
            <div style={styleCommon}>
              <span style={styleTitle}> 计划结束时间</span> :&nbsp;
              {recordCur == undefined ? '' : recordCur!.planManufactEndDate}
            </div>
            {/* <div style={styleCommon}>
                备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:
                {recordCur == undefined ? '' : recordCur!.memo}
              </div> */}
          </Col>
          {/* <Col span={4}></Col> */}
        </Row>
      ),
    },
    {
      name: 'tab2',
      label: 'BOM列表',
      content: (
        <div>
          <Table columns={bomColumns} bordered dataSource={bomData} pagination={{ pageSize: 7 }} scroll={{ y: 480 }}/>
        </div>
      ),
    },
    {
      name: 'tab3',
      label: '生产进度',
      content: (
        <div>
          <Table
            columns={manuColumns}
            bordered
            dataSource={manufactInfo}
            pagination={{ pageSize: 7 }}
            scroll={{ y: 480 }}
          />
        </div>
      ),
    },
    {
      name: 'tab4',
      label: '图纸列表',
      content: (
        <div>
          <Table
            columns={drawColumns}
            bordered
            dataSource={drawData}
            pagination={{ pageSize: 7 }}
            scroll={{ y: 480 }}
          />
        </div>
      ),
    },
    // {
    //   name: 'tab5',
    //   label: '图纸打印信息',
    //   content: (
    //     <div style={{ height: 500 }}>
    //       <Table
    //         columns={draw_printcolumns}
    //         bordered
    //         dataSource={draw_print}
    //         pagination={{ pageSize: 7 }}
    //       />
    //     </div>
    //   ),
    // },
  ];

  const columns: ProColumns[] = [
    {
      title: '序号',
      dataIndex: 'index',
      valueType: 'index',
      width: 80,
      align: 'center',
      sorter: true,
      fixed: 'left',
    },
    {
      title: '项目编号',
      dataIndex: 'projectCode',
      fixed: 'left',
      align: 'center',
      sorter: true,
      width: 200,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '项目名称',
      dataIndex: 'projectName',
      fixed: 'left',
      align: 'center',
      sorter: true,
      width: 300,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '当前批次',
      dataIndex: 'currentBatch',
      fixed: 'left',
      align: 'center',
      sorter: true,
      width: 100,
      render: (text, record, _, action) => {
        return record.currentBatch + '/' + record.batchCount;
      },
    },
    /*     {
          title: '批次交付',
          dataIndex: 'batchCount',
          align: 'center',
          sorter: true,
          width: 100,
          render: (text, record, _, action) => {
            return record.currentBatch + '/' + record.batchCount;
          },
        }, */
    {
      title: '批次交付日期',
      dataIndex: 'batchDeliveryDate',
      search: false,
      fixed: 'left',
      align: 'center',
      sorter: true,
      width: 130,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '工单编号',

      dataIndex: 'wo',
      align: 'center',
      sorter: true,
      width: 240,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '柜体编号',
      dataIndex: 'batchProductCode',
      width: 240,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    /* 生产进度添加 */
    {
      title: '生产进度',
      dataIndex: 'children',
      align: 'center',
      // sorter: true,
      width: 480,
      render: (text) => (
        <div className="projectScheduleTag">
          {text &&
            text.map((tag: any) => {
              let color;
              //条件渲染生产进度的流程颜色
              switch (tag.alertStatus) {
                case 0:
                  color = 'blue';
                  break;
                case 1:
                  color = 'green';
                  break;
                case 2:
                  color = 'yellow';
                  break;
                case 3:
                  color = 'gray';
                  break;
                case 4:
                  color = 'purple';
                  break;
                case 5:
                  color = 'red';
                  break;
              }
              return (
                <Tag color={color} key={tag.id}>
                  {tag.processName}
                </Tag>
              );
            })}
        </div>
      ),
    },

    // },
    // {
    //   title: '柜体类型',
    //   dataIndex: 'productType',
    //  align: 'center',sorter: true,
    // },
    {
      title: '工单状态',
      dataIndex: 'state',
      width: 100,
      align: 'center',
      sorter: true,
      render: (text) => {
        return <div>{state[Number(text)]}</div>;
      },
      // valueType: 'select',
      // request: async () => [
      //   { label: '未开始', value: 0 },
      //   { label: '执行中', value: 1 },
      //   { label: '已结束', value: 2 },
      // ],
    },
    // {
    //   title: '工单预警',
    //   dataIndex: 'alertStatus',
    //   width: 100,
    //   align: 'center',
    //   sorter: true,
    //   render: (text) => {
    //     let color = 'white-retangle base-retangle';
    //     if (text === 1) {
    //       color = 'green-retangle base-retangle';
    //     } else if (text === 2) {
    //       color = 'black-retangle base-retangle';
    //     } else if (text === 3) {
    //       color = 'purple-retangle base-retangle';
    //     } else if (text === 4) {
    //       color = 'red-retangle base-retangle';
    //     }
    //     return <div className={color}></div>;
    //   },
    // },
    // {
    //   title: '释放标识',
    //   dataIndex: 'releaseFlag', // 0 未释放 1-已释放
    //   width: 150,
    //   align: 'center',
    //   sorter: true,
    //   render: (text) => {
    //     return <div>{text === 0 ? '未释放' : '已释放'}</div>;
    //   },
    // },

    // {
    //   title: '释放时间',
    //   dataIndex: 'releaseTime',
    //   width: 110,

    //   valueType: 'date',
    //   align: 'center',
    //   sorter: true,
    //   search: false, //修改为时间的话，搜索不太好做，因为这里传值API对应参数类型会有问题
    // },
    {
      title: '排程状态',
      width: 120,
      dataIndex: 'scheduledFlag', // 0- 未排程 1-自动排程 2-手动排程
      align: 'center',
      sorter: true,
      render: (text) => {
        return <div>{statusArray[Number(text)]}</div>;
      },
    },

    /*     {
      title: '工单完成日期', //表头显示的名称
      search: false,
      width: 120,
      // dataIndex: 'createTime',
      dataIndex: 'closeTime',
     align: 'center',sorter: true, 
    }, */
    {
      title: '创建日期', //表头显示的名称
      search: false,
      width: 200,
      dataIndex: 'createTime',
      align: 'center',
      sorter: true,
    },
    {
      title: '创建人', //表头显示的名称
      search: false,
      width: 100,
      dataIndex: 'createName',
      align: 'center',
      sorter: true,
    },
    {
      title: '操作',
      valueType: 'option',
      key: 'option',
      fixed: 'right',
      align: 'center',
      width: 140,
      render: (text, record, _, action) => [
        <a
          key="lookforKey"
          onClick={(e) => {
            openLookfor(record.id, record);
            setthewoid(record.id);
          }}
        >
          查看
        </a>,
        /*         <a
          key="releaseKey"
          onClick={(e) => {
            Modal.confirm({
              title: '释放',
              content: '确定要释放吗',
              okText: '确认',
              cancelText: '取消',
              onOk: async () => {
                releaseFuc(record.id);
              },
            });
          }}
        >
          释放
        </a>, */
        pagestate == '1' && (
          <a
            key="closeKey"
            onClick={async (e) => {
              Modal.confirm({
                title: '关闭',
                content: '确定要关闭吗',
                okText: '确认',
                cancelText: '取消',
                onOk: async () => {
                  const result = await closeWorkOrderInfor(record.id);
                  if (result && result.code === 0) {
                    message.success(result.message);
                  }
                  actionRef.current!.reload();
                },
              });
            }}
          >
            关闭
          </a>
        ),
      ],
    },
  ];

  const inColumns: ProColumns[] = [
    {
      title: '序号',
      dataIndex: 'index',
      valueType: 'index',
      width: 80,
      align: 'center',
      sorter: true,
    },
    {
      title: '项目编号',
      dataIndex: 'projectCode',

      align: 'center',
      sorter: true,
      width: 200,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '项目名称',
      dataIndex: 'projectName',

      align: 'center',
      sorter: true,
      width: 300,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '当前批次',
      dataIndex: 'currentBatch',
      align: 'center',
      sorter: true,
      width: 100,
      render: (text, record, _, action) => {
        return record.currentBatch + '/' + record.batchCount;
      },
    },
    /*     {
          title: '批次交付',
          dataIndex: 'batchCount',
          align: 'center',
          sorter: true,
          width: 100,
          render: (text, record, _, action) => {
            return record.currentBatch + '/' + record.batchCount;
          },
        }, */
    {
      title: '批次交付日期',
      dataIndex: 'batchDeliveryDate',
      search: false,
      align: 'center',
      sorter: true,
      width: 130,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '工单编号',

      dataIndex: 'wo',
      align: 'center',
      sorter: true,
      width: 240,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    {
      title: '柜体编号',
      dataIndex: 'batchProductCode',
      width: 240,
      align: 'center',
      sorter: true,
      render: (text) => <>{Ellipsis(text)}</>,
    },
    /* 生产进度添加 */
    {
      title: '生产进度',
      dataIndex: 'children',
      align: 'center',
      // sorter: true,
      width: 480,
      render: (text) => (
        <div className="projectScheduleTag">
          {text &&
            text.map((tag: any) => {
              let color;
              //条件渲染生产进度的流程颜色
              switch (tag.alertStatus) {
                case 0:
                  color = 'blue';
                  break;
                case 1:
                  color = 'green';
                  break;
                case 2:
                  color = 'yellow';
                  break;
                case 3:
                  color = 'gray';
                  break;
                case 4:
                  color = 'purple';
                  break;
                case 5:
                  color = 'red';
                  break;
              }
              return (
                <Tag color={color} key={tag.id}>
                  {tag.processName}
                </Tag>
              );
            })}
        </div>
      ),
    },

    // },
    // {
    //   title: '柜体类型',
    //   dataIndex: 'productType',
    //  align: 'center',sorter: true,
    // },
    {
      title: '工单状态',
      dataIndex: 'state',
      width: 100,
      align: 'center',
      sorter: true,
      render: (text) => {
        return <div>{state[Number(text)]}</div>;
      },
      // valueType: 'select',
      // request: async () => [
      //   { label: '未开始', value: 0 },
      //   { label: '执行中', value: 1 },
      //   { label: '已结束', value: 2 },
      // ],
    },
    {
      title: '工单预警',
      dataIndex: 'alertStatus',
      width: 100,
      align: 'center',
      sorter: true,
      render: (text) => {
        let color = 'white-retangle base-retangle';
        if (text === 1) {
          color = 'green-retangle base-retangle';
        } else if (text === 2) {
          color = 'black-retangle base-retangle';
        } else if (text === 3) {
          color = 'purple-retangle base-retangle';
        } else if (text === 4) {
          color = 'red-retangle base-retangle';
        }
        return <div className={color}></div>;
      },
    },
    // {
    //   title: '释放标识',
    //   dataIndex: 'releaseFlag', // 0 未释放 1-已释放
    //   width: 150,
    //   align: 'center',
    //   sorter: true,
    //   render: (text) => {
    //     return <div>{text === 0 ? '未释放' : '已释放'}</div>;
    //   },
    // },

    // {
    //   title: '释放时间',
    //   dataIndex: 'releaseTime',
    //   width: 110,

    //   valueType: 'date',
    //   align: 'center',
    //   sorter: true,
    //   search: false, //修改为时间的话，搜索不太好做，因为这里传值API对应参数类型会有问题
    // },
    {
      title: '排程状态',
      width: 120,
      dataIndex: 'scheduledFlag', // 0- 未排程 1-自动排程 2-手动排程
      align: 'center',
      sorter: true,
      render: (text) => {
        return <div>{statusArray[Number(text)]}</div>;
      },
    },

    /*     {
      title: '工单完成日期', //表头显示的名称
      search: false,
      width: 120,
      // dataIndex: 'createTime',
      dataIndex: 'closeTime',
     align: 'center',sorter: true, 
    }, */
    {
      title: '创建日期', //表头显示的名称
      search: false,
      width: 200,
      dataIndex: 'createTime',
      align: 'center',
      sorter: true,
    },
    {
      title: '创建人', //表头显示的名称
      search: false,
      width: 100,
      dataIndex: 'createName',
      align: 'center',
      sorter: true,
    },
    {
      title: '操作',
      valueType: 'option',
      key: 'option',
      fixed: 'right',
      align: 'center',
      width: 140,
      render: (text, record, _, action) => [
        <a
          key="lookforKey"
          onClick={(e) => {
            openLookfor(record.id, record);
            setthewoid(record.id);
          }}
        >
          查看
        </a>,

        pagestate == '1' && (
          <a
            key="closeKey"
            onClick={async (e) => {
              Modal.confirm({
                title: '关闭',
                content: '确定要关闭吗',
                okText: '确认',
                cancelText: '取消',
                onOk: async () => {
                  const result = await closeWorkOrderInfor(record.id);
                  if (result && result.code === 0) {
                    message.success(result.message);
                  }
                  actionRef.current!.reload();
                },
              });
            }}
          >
            关闭
          </a>
        ),
      ],
    },
  ];

  const orderList: tabType[] = [
    /*     {
      name: 'tab1',
      label: '工艺工时',
      content: (
        <div>
          <ProTable
            headerTitle="工艺工时维护"
            actionRef={actionRef} //用于触发刷新操作等，看api
            rowKey="id" //表格行 key 的取值，可以是字符串或一个函数
            formRef={ref}
            search={tableSearchPublicConfig}
            toolBarRender={(action, { selectedRows }) => [
              <Button
                key="workhour_button"
                type="primary"
                onClick={async () => {
                  //去除重复项
                  let hash = {};
                  var newArr = selections.reduce((prev, next) => {
                    hash[next.projectCode]
                      ? ''
                      : (hash[next.projectCode] = true && prev.push(next));
                    return prev;
                  }, []);
                  // console.log(selections,'处理前的项目信息');
                  // console.log( newArr,'处理后的项目信息');
                  if (newArr.length === 0) {
                    message.info('请选择柜体');
                  } else if (newArr.length > 1) {
                    message.info('暂不支持批量下载');
                  } else {
                    exportWorkhourAndCycle(newArr[0]).then((res) => {
                      const aLink = document.createElement('a');
                      document.body.appendChild(aLink);
                      aLink.style.display = 'none';
                      aLink.href = window.URL.createObjectURL(res);
                      const filenmae = '工时模板_' + newArr[0].projectName + '.xlsx';
                      aLink.setAttribute('download', filenmae);
                      aLink.click();
                      document.body.removeChild(aLink);
                    });
                  }
                }}
              >
                工时模板下载
              </Button>,
              <Button
                key="workhour_upload_button"
                type="primary"
                onClick={() => {
                  setModalVisit4(true);
                  form.setFieldsValue({
                    file: '',
                  });
                }}
              >
                工时上传
              </Button>,
              <Button
                key="button1"
                icon={<PlusOutlined />}
                onClick={() => {
                  const res = { reviewState: 0 };
                  const filters = filterTranNew(res);
                  exportBatchProduct({
                    current: 1,
                    pageSize: 5000,
                    filters: filters,
                  }).then((res) => {
                    const aLink = document.createElement('a');
                    document.body.appendChild(aLink);
                    aLink.style.display = 'none';
                    aLink.href = window.URL.createObjectURL(res);
                    aLink.setAttribute('download', `BatchProduct.xlsx`);
                    aLink.click();
                    document.body.removeChild(aLink);
                  });
                }}
                type="primary"
              >
                导出
              </Button>,
            ]}
            request={async (params = {}, sort, filter) => {
              const res = { ...params, reviewState: 0 };
              const sorters = sortTran(sort);
              const filters = filterTranNew(res);
              const result = await getBatchProductByPage({
                ...params,
                sorters: sorters,
                filters: filters,
              });
              console.log(result, '接口返回数据tab1');
              getproductbop();
              return {
                data: result.data.content,
                total: result.data.totalElements,
                success: result.success,
              };
            }}
            columns={tobeSubmitted}
            scroll={{ x: 2730, y: 450 }}
            rowSelection={{
              selections,
              ...rowSelection,
            }}
          />
        </div>
      ),
    }, */
    {
      name: 'tab1',
      label: '未开始',
      content: (
        <div className="workOrderInfor">
          <ProTable
            search={tableSearchPublicConfig}
            headerTitle="生产工单查询"
            actionRef={actionRef} //用于触发刷新操作等，看api
            rowKey="id" //表格行 key 的取值，可以是字符串或一个函数
            toolBarRender={(action, { selectedRows }) => [
              <div className="projectScheduleGroup">
                <span>待执行：</span>
                <img src="../wks.gif" />
                <span>执行中：</span>
                <img src="../zxz.gif"></img>
                <span>已完成：</span>
                <img src="../wc.gif"></img>
                <span>未按计划开始：</span>
                <img src="../purple.png"></img>
                <span>未按计划结束：</span>
                <img src="../red.png"></img>
              </div>,
              <Button
                key="button"
                icon={<PlusOutlined />}
                onClick={() => {
                  const filters = filterTranNew(ref.current.getFieldsValue());
                  exportWorkOrderInfor({
                    current: 1,
                    pageSize: 5000,
                    filters: filters,
                  }).then((res) => {
                    const aLink = document.createElement('a');
                    document.body.appendChild(aLink);
                    aLink.style.display = 'none';
                    aLink.href = window.URL.createObjectURL(res);
                    aLink.setAttribute('download', `WorkOrderInfor.xlsx`);
                    aLink.click();
                    document.body.removeChild(aLink);
                  });
                }}
                type="primary"
              >
                导出
              </Button>,
            ]}
            request={async (params = {}, sort, filter) => {
              const sorters = sortTran(sort);
              const filters = filterTranNew(params);
              const result = await getWorkOrderInforExtendByPage({
                ...params,
                sorters: sorters,
                filters: filters,
                current: 1,
                pageSize: 100,
              });
              const temp = result.data.content.map((item: any) => {
                item.workOrderInforEx = { ...item.workOrderInforEx, children: item.children };
                return item.workOrderInforEx;
              });
              const resultNotBegin = temp.filter((item: any) => item.state === 0);
              // console.log(resultNotBegin);
              return {
                data: resultNotBegin,
                total: resultNotBegin.totalElements,
                success: result.success,
              };
            }}
            columns={columns}
            // scroll={{ x: 2000, y: 350 }}
            scroll={{ x: 2000, y: 'calc(100vh - 460px)' }}
            rowSelection={{}}
            pagination={{
              pageSize: 100,
              pageSizeOptions: [100, 500, 1000],
            }}
          />
        </div>
      ),
    },
    {
      name: 'tab2',
      label: '执行中',
      content: (
        <div className="workOrderInfor">
          <ProTable
            search={tableSearchPublicConfig}
            headerTitle="生产工单查询"
            actionRef={actionRef} //用于触发刷新操作等，看api
            rowKey="id" //表格行 key 的取值，可以是字符串或一个函数
            toolBarRender={(action, { selectedRows }) => [
              <div className="projectScheduleGroup">
                <span>未开始：</span>
                <img src="../wks.gif" />
                <span>执行中：</span>
                <img src="../zxz.gif"></img>
                <span>已结束：</span>
                <img src="../wc.gif"></img>
                <span>未按计划开始：</span>
                <img src="../purple.png"></img>
                <span>未按计划结束：</span>
                <img src="../red.png"></img>
              </div>,
              <Button
                key="button"
                icon={<PlusOutlined />}
                onClick={() => {
                  const filters = filterTranNew(ref.current.getFieldsValue());
                  exportWorkOrderInfor({
                    current: 1,
                    pageSize: 5000,
                    filters: filters,
                  }).then((res) => {
                    const aLink = document.createElement('a');
                    document.body.appendChild(aLink);
                    aLink.style.display = 'none';
                    aLink.href = window.URL.createObjectURL(res);
                    aLink.setAttribute('download', `WorkOrderInfor.xlsx`);
                    aLink.click();
                    document.body.removeChild(aLink);
                  });
                }}
                type="primary"
              >
                导出
              </Button>,
            ]}
            request={async (params = {}, sort, filter) => {
              const sorters = sortTran(sort);
              const filters = filterTranNew(params);
              const result = await getWorkOrderInforExtendByPage({
                ...params,
                sorters: sorters,
                filters: filters,
              });
              const temp = result.data.content.map((item: any) => {
                item.workOrderInforEx = { ...item.workOrderInforEx, children: item.children };
                return item.workOrderInforEx;
              });
              const resultNotBegin = temp.filter((item: any) => item.state === 1);
              return {
                data: resultNotBegin,
                total: resultNotBegin.totalElements,
                success: result.success,
              };
            }}
            columns={inColumns}
            // scroll={{ x: 2000, y: 350 }}
            scroll={{ x: 2000, y: 'calc(100vh - 460px)' }}
            rowSelection={{}}
            pagination={{
              pageSize: 100,
              pageSizeOptions: [100, 500, 1000],
            }}
          />
        </div>
      ),
    },
    {
      name: 'tab3',
      label: '已结束',
      content: (
        <div className="workOrderInfor">
          <ProTable
            search={tableSearchPublicConfig}
            headerTitle="生产工单查询"
            actionRef={actionRef} //用于触发刷新操作等，看api
            rowKey="id" //表格行 key 的取值，可以是字符串或一个函数
            toolBarRender={(action, { selectedRows }) => [
              <div className="projectScheduleGroup">
                <span>待执行：</span>
                <img src="../wks.gif" />
                <span>执行中：</span>
                <img src="../zxz.gif"></img>
                <span>已完成：</span>
                <img src="../wc.gif"></img>
                <span>未按计划开始：</span>
                <img src="../purple.png"></img>
                <span>未按计划结束：</span>
                <img src="../red.png"></img>
              </div>,
              <Button
                key="button"
                icon={<PlusOutlined />}
                onClick={() => {
                  const filters = filterTranNew(ref.current.getFieldsValue());
                  exportWorkOrderInfor({
                    current: 1,
                    pageSize: 5000,
                    filters: filters,
                  }).then((res) => {
                    const aLink = document.createElement('a');
                    document.body.appendChild(aLink);
                    aLink.style.display = 'none';
                    aLink.href = window.URL.createObjectURL(res);
                    aLink.setAttribute('download', `WorkOrderInfor.xlsx`);
                    aLink.click();
                    document.body.removeChild(aLink);
                  });
                }}
                type="primary"
              >
                导出
              </Button>,
            ]}
            request={async (params = {}, sort) => {
              const sorters = sortTran(sort);
              const filters = filterTranNew(params);
              const result = await getWorkOrderInforExtendByPage({
                ...params,
                sorters: sorters,
                filters: filters,
              });
              const temp = result.data.content.map((item: any) => {
                item.workOrderInforEx = { ...item.workOrderInforEx, children: item.children };
                return item.workOrderInforEx;
              });
              const resultNotBegin = temp.filter((item: any) => item.state === 2);
              return {
                data: resultNotBegin,
                total: resultNotBegin.totalElements,
                success: result.success,
              };
            }}
            columns={columns}
            // scroll={{ x: 2000, y: 350 }}
            scroll={{ x: 2000, y: 'calc(100vh - 460px)' }}
            rowSelection={{}}
            pagination={{
              pageSize: 100,
              pageSizeOptions: [100, 500, 1000],
            }}
          />
        </div>
      ),
    },
  ];

  return (
    <PageHeaderWrapper title={false} breadcrumb={undefined}>
      <div className="box">
        <Tabs
          type="card"
          defaultActiveKey="0"
          onChange={(e) => {
            setPageState(String(e));
          }}
          items={orderList.map((item, index) => {
            return {
              label: item.label,
              key: index.toString(), // 使用索引作为键值
              children: <div>{item.content}</div>,
            };
          })}
        />
      </div>

      {/* Modal查看功能 */}
      <Modal
        open={open}
        title="查看工单"
        destroyOnClose
        width={1000}
        //onOk={handleOk}
        onCancel={handleCancel}
        footer={[
          <Button key="back" onClick={() => handleCancel()}>
            关闭
          </Button>,
        ]}
      >
        <div style={{ height: 600 }}>
          <Tabs
            tabPosition="left"
            items={tabList.map((item, i) => {
              const id = String(i + 1);
              return {
                label: item.label,
                key: id,
                children: <div>{item.content}</div>,
              };
            })}
          />
        </div>
      </Modal>

      {/* 工艺 */}
      <Modal
        title={formTitle}
        visible={modalVisit}
        onOk={handleSubmit}
        confirmLoading={confirmLoading}
        onCancel={() => setModalVisit(false)}
        destroyOnClose
      >
        <Form
          name="wrap"
          labelCol={{ flex: '110px' }}
          labelAlign="left"
          labelWrap
          form={form}
          wrapperCol={{ flex: 1 }}
          colon={false}
        >
          <Form.Item
            label="批次柜体id"
            name="unStandTypeId"
            rules={[{ required: true, message: '请输入批次柜体id!' }]}
            hidden={true}
          >
            <Input disabled />
          </Form.Item>
          <Form.Item
            label="柜体编号"
            name="productCode"
            // rules={[{ required: true, message: '请输入柜体编号!' }]}
          >
            <Input disabled />
          </Form.Item>
          <Form.Item
            label="柜体描述"
            name="productDesc"
            // rules={[{ required: true, message: '请输入柜体描述!' }]}
          >
            <Input disabled />
          </Form.Item>
          <Form.Item
            label="工艺路径"
            name="bopCode"
            rules={[{ required: true, message: '请选择工艺路径!' }]}
          >
            <Select
              disabled={recordInfo?.reviewState == 1}
              placeholder="请选择工艺路径"
              onChange={(value) => {}}
              options={optionsbopCode}
            />
          </Form.Item>
        </Form>
      </Modal>

      {/* 工时 */}
      <Modal
        title="工序工时"
        width={1200}
        open={modalVisit3}
        onCancel={() => {
          setModalVisit3(false);
        }}
        destroyOnClose
        footer={[
          <Button
            key="back"
            onClick={() => {
              setModalVisit3(false);
            }}
          >
            关闭
          </Button>,
        ]}
      >
        <UnstandprocessInfo
          bopcode={thebopcode}
          unStandTypeId={theunStandTypeId}
          typecode={thetypecode}
          typename={thetypename}
          desc={thedesc}
        />
      </Modal>

      {/* 工时上传 */}
      <Modal
        title="上传工时周期"
        visible={modalVisit4}
        onOk={workhour_upload}
        confirmLoading={confirmLoading4}
        onCancel={() => setModalVisit4(false)}
        destroyOnClose
      >
        <Form
          name="wrap"
          labelCol={{ flex: '110px' }}
          labelAlign="left"
          labelWrap
          form={form}
          wrapperCol={{ flex: 1 }}
          colon={false}
        >
          <Form.Item
            label="上传文件"
            name="file"
            rules={[{ required: true, message: '请上传工时周期文件!' }]}
          >
            <Upload
              accept="application"
              //listType="picture-card"
              file-list="fileList"
              customRequest={onFilesChange} //通过覆盖默认的上传行为，可以自定义自己的上传实现
              showUploadList={true}
              beforeUpload={beforeUpload}
            >
              <Button icon={<UploadOutlined />}>上传文件</Button>
            </Upload>
          </Form.Item>
        </Form>
      </Modal>
      {/* <Modal
        open={printOpen}
        title="打印预览"
        width={1200}
        onOk={() => {
          setPrintOpen(false);
        }}
        onCancel={() => {
          setPrintOpen(false);
        }}
      >
        <div style={{ height: 600 }}>
          <iframe
            src="http://47.100.77.32:9000/standfile/null%2BCoevolutionary_Particle_Swarm_Optimization_With_Bottleneck_Objective_Learning_Strategy_for_Many-Objective_Optimization.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=admin%2F20230404%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230404T085113Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=ce54cfa3ac38955a5839bc2a9a12b98d0f18e3c1c80d62dd6c908781fb444541"
            frameborder="0"
            width={1200}
            height={600}
          ></iframe>
        </div>
      </Modal> */}
    </PageHeaderWrapper>
  );
};
export default WorkOrderInfor;
